home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 May / CMCD0504.ISO / Software / Freeware / Programare / dspack / DSPACK231.exe / {app} / src / DSPack / DSEditors.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-02-21  |  4.7 KB  |  132 lines

  1.  
  2.     (*********************************************************************
  3.      *  DSPack 2.3                                                       *
  4.      *                                                                   *
  5.      *  home page : http://www.progdigy.com                              *
  6.      *  email     : hgourvest@progdigy.com                               *
  7.      *   Thanks to Michael Andersen. (DSVideoWindowEx)                   *
  8.      *                                                                   *
  9.      *  date      : 21-02-2003                                           *
  10.      *                                                                   *
  11.      *  The contents of this file are used with permission, subject to   *
  12.      *  the Mozilla Public License Version 1.1 (the "License"); you may  *
  13.      *  not use this file except in compliance with the License. You may *
  14.      *  obtain a copy of the License at                                  *
  15.      *  http://www.mozilla.org/MPL/MPL-1.1.html                          *
  16.      *                                                                   *
  17.      *  Software distributed under the License is distributed on an      *
  18.      *  "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or   *
  19.      *  implied. See the License for the specific language governing     *
  20.      *  rights and limitations under the License.                        *
  21.      *                                                                   *
  22.      *********************************************************************)
  23.  
  24. unit DSEditors;
  25.  
  26. {$IFDEF VER150}
  27.   {$WARN UNSAFE_CODE OFF}
  28.   {$WARN UNSAFE_TYPE OFF}
  29.   {$WARN UNSAFE_CAST OFF}
  30. {$ENDIF}
  31.  
  32. interface
  33. uses
  34. {$IFDEF VER140} DesignIntf, DesignEditors, {$ELSE}
  35. {$IFDEF VER150} DesignIntf, DesignEditors, {$ELSE}
  36.  DsgnIntf, {$ENDIF} {$ENDIF}
  37.  Forms, Controls, DSUtil, DSPack;
  38.  
  39. type
  40.  
  41. // *****************************************************************************
  42. //  TMediaTypePropertyClass
  43. // *****************************************************************************
  44.  
  45.   TMediaTypePropertyClass = class(TClassProperty)
  46.   public
  47.     procedure Edit; override;
  48.     function GetAttributes: TPropertyAttributes; override;
  49.   end;
  50.  
  51. // *****************************************************************************
  52. //  TBaseFilterPropertyClass
  53. // *****************************************************************************
  54.  
  55.   TBaseFilterPropertyClass = class(TClassProperty)
  56.   public
  57.     procedure Edit; override;
  58.     function GetAttributes: TPropertyAttributes; override;
  59.   end;
  60.  
  61.   procedure Register;
  62.  
  63. implementation
  64.  
  65. uses MediaTypeEditor, BaseFilterEditor, Classes;
  66.  
  67. // *****************************************************************************
  68. //  TMediaTypePropertyClass
  69. // *****************************************************************************
  70.  
  71.   procedure TMediaTypePropertyClass.Edit;
  72.   var
  73.     Dlg: TFormMediaType;
  74.   begin
  75.     Dlg := TFormMediaType.create(Application);
  76.     try
  77.       Dlg.MediaType.Assign(TMediaType(GetOrdValue));
  78.       if Dlg.ShowModal = mrOk then
  79.       begin
  80.         TMediaType(GetOrdValue).Assign(Dlg.MediaType);
  81.         if (GetComponent(0) is TSampleGrabber) then
  82.           IFilter(GetComponent(0) as TSampleGrabber).NotifyFilter(foRefresh);
  83.         Modified;
  84.       end;
  85.     finally
  86.       Dlg.Free;
  87.     end;
  88.   end;
  89.  
  90.   function TMediaTypePropertyClass.GetAttributes: TPropertyAttributes;
  91.   begin
  92.     Result := [paDialog];
  93.   end;
  94.  
  95. // *****************************************************************************
  96. //  TBaseFilterPropertyClass
  97. // *****************************************************************************
  98.  
  99.   procedure TBaseFilterPropertyClass.Edit;
  100.   var
  101.     Dlg: TFormBaseFilter;
  102.   begin
  103.     Dlg := TFormBaseFilter.create(Application);
  104.     try
  105.       Dlg.Filter.BaseFilter.Assign(TBaseFilter(GetOrdValue));
  106.       if Dlg.ShowModal = mrOk then
  107.       begin
  108.         TBaseFilter(GetOrdValue).Assign(Dlg.Filter.BaseFilter);
  109.         if (GetComponent(0) is TFilter) then
  110.           IFilter(GetComponent(0) as TFilter).NotifyFilter(foRefresh);
  111.         Modified;
  112.       end;
  113.     finally
  114.       Dlg.Free;
  115.     end;
  116.   end;
  117.  
  118.   function TBaseFilterPropertyClass.GetAttributes: TPropertyAttributes;
  119.   begin
  120.     Result := [paDialog];
  121.   end;
  122.  
  123.   procedure Register;
  124.   begin
  125.     RegisterComponents('DSPack', [TFilterGraph, TVideoWindow, TSampleGrabber,
  126.       TFilter, TASFWriter, TDSTrackBar, TDSVideoWindowEx2]);  
  127.     RegisterPropertyEditor(TypeInfo(TMediaType), nil, '', TMediaTypePropertyClass);
  128.     RegisterPropertyEditor(TypeInfo(TBaseFilter), nil, '', TBaseFilterPropertyClass);
  129.   end;
  130.  
  131. end.
  132.